package org.example.lethear.dto.category;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * 分类响应DTO
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CategoryDTO {
    
    private Long id;
    
    private String name;
    
    private String description;
    
    private Long parentId;
    
    private Integer sort;
    
    private Integer status;
    
    private LocalDateTime createTime;
    
    private LocalDateTime updateTime;
    
    private Integer postCount;
    
    // 便利方法
    public boolean isActive() {
        return status != null && status == 1;
    }
    
    public void setIsActive(Boolean isActive) {
        this.status = (isActive != null && isActive) ? 1 : 0;
    }
    
    public Boolean getIsActive() {
        return status != null && status == 1;
    }
} 